

#ifndef VIEWS_H__
#define VIEWS_H__

#include "gui.h"

#include "image_list.h"
#include "font_list.h"
#include "watchface.h"

#define BUTTON_UP       0
#define BUTTON_BOTTOM   1
#define BUTTON_LEFT     2
#define BUTTON_RIGHT    3
#define BUTTON_CONFIRM  4


typedef int (*setup_time_cb_t) (uint8_t hour,uint8_t minu);

typedef struct setup_time_stru{
    uint16_t textid;
    uint8_t  hour;
    uint8_t  minute;
    uint8_t  *phour;
    uint8_t  *pminute;
    setup_time_cb_t cb;
    const gui_view_t *parent;
}setup_time_st;

typedef int (*setup_date_cb_t) (uint8_t year,uint8_t month,uint8_t day);

typedef struct setup_date_stru{
    uint16_t textid;
    uint8_t  year;
    uint8_t  month;
    uint8_t  day;
    uint8_t  *pyear;
    uint8_t  *pmonth;
    uint8_t  *pday;
    setup_date_cb_t cb;
    const gui_view_t *parent;
}setup_date_st;

void view_enter_setup_time(const gui_view_t *parent,uint16_t textid,uint8_t *p_hour,uint8_t *p_minute,setup_time_cb_t cb);
void view_enter_setup_date(const gui_view_t *parent,uint16_t textid,uint8_t *p_year,uint8_t *p_month,uint8_t *p_day,setup_date_cb_t cb);


#define VIEWS_LIFETIME_DEFAULT  (5000)

#define SIZE_SCALE(v) ((uint16_t)((v)*1.5+0.5))

// void views_value( views_value_t* v );
// const views_value_t* views_value_get(void); 
// void views_value_reset(void); 
// views_value_t* views_value_get_ptr( void ); 

uint32_t views_fsm_get(void);
void views_set_fsm(uint32_t value); 
void views_fsm_reset(void);
void views_fsm_init(uint32_t min, uint32_t max);
uint32_t views_fsm_inc(void);
uint32_t views_fsm_dec(void);
void views_fsm_toggle(void);

void views_reset_timeout(void);
uint32_t views_get_timeout_cnt(void);
uint32_t views_timeout_inc(void); 

void views_animate_set_count(int count);
uint32_t views_animate_get_idx(void);
uint32_t views_animate_get_idx_by_step(void);
void views_animate_set_idx(int idx);
void views_animate_add_idx(int idx); 

gui_view_t const* views_load_exercise_record(void);

extern const gui_view_t manageIdle; 
extern const gui_view_t manageTransition;



extern const gui_view_t viewNotif_Logo;
extern const gui_view_t viewNotif_OTA;
extern const gui_view_t viewNotif_TPDfu;
extern const gui_view_t viewNotif_Alarmclock;
extern const gui_view_t viewNotif_Fatigue;
extern const gui_view_t viewNotif_FindPhone;
extern const gui_view_t viewNotif_BatteryCharging;
extern const gui_view_t viewNotif_IncomingCall;
extern const gui_view_t viewNotif_MissedCall;
extern const gui_view_t viewNotif_MessageNew;
extern const gui_view_t viewNotif_MessageDetail; 
extern const gui_view_t viewNotif_SOS;
extern const gui_view_t viewWatchface;

extern const gui_view_t viewApp_Pedometer;
extern const gui_view_t viewApp_Shortcut;
extern const gui_view_t viewApp_Heartrate;
extern const gui_view_t viewApp_SPO2;
extern const gui_view_t viewApp_Bloodpressure;
extern const gui_view_t viewApp_Sleep; 
extern const gui_view_t viewApp_SleepDetail; 
extern const gui_view_t viewAppsList;
extern const gui_view_t viewApp_Temperature;

extern const gui_view_t viewExercise_Selection;
extern const gui_view_t viewExercise_Counting;
extern const gui_view_t viewExercise_Tips;
// extern const gui_view_t viewExercise_Record; 

// extern const gui_view_t viewNewMessage;
extern const gui_view_t viewNotif_FindMe; 
extern const gui_view_t viewNotif_ReachGoal;
extern const gui_view_t viewTools_TimerElapsed;
extern const gui_view_t viewFactoryTest;
extern const gui_view_t viewTools_Camera;
extern const gui_view_t viewTools_MusicControl;




extern const gui_view_t viewTools_Stopwatch;
extern const gui_view_t viewTools_StopwatchRecord; 


extern const gui_view_t viewWatch_Language;
extern const gui_view_t viewWatch_Option; 
extern const gui_view_t viewSystem_Power; 


//extern const gui_view_t viewWatchface0;
extern const gui_view_t viewWatchface; 
extern const gui_view_t viewWatchface1;
extern const gui_view_t viewWatchface2;
extern const gui_view_t viewWatchface3;
extern const gui_view_t viewWatchface4;
extern const gui_view_t viewWatchface5;
extern const gui_view_t viewWatchface6;
extern const gui_view_t viewWatchface7;
extern const gui_view_t viewWatchface8;
extern const gui_view_t viewWatchface9;
extern const gui_view_t viewWatchface10;
extern const gui_view_t viewWatchface11;
extern const gui_view_t viewWatchface12;
extern const gui_view_t viewWatchfacePreview; 


extern const gui_view_t viewSettings_Brightness;

extern const gui_view_t viewApp_MessageList; 

extern const gui_view_t viewTools_TimerCustom; 
extern const gui_view_t viewTools_TimerSelect; 
extern const gui_view_t viewTools_FindPhone;

extern const gui_view_t viewDevInfo; 
extern const gui_view_t viewDevInfo_Qrcode; 
extern const gui_view_t viewDevInfo_AppLink; 

extern const gui_view_t viewMsgBox; // 无按键
extern const gui_view_t viewMsgBox_OK; // 单按键OK
extern const gui_view_t viewMsgBox_OKCancel; // 消息框，用于提示信息

// factory test
extern const gui_view_t viewFactoryTest_Gsensor;
extern const gui_view_t viewFactoryTest_TP_CLICK;
extern const gui_view_t viewFactoryTest_LCD; 
extern const gui_view_t viewFactoryTest_TP_Lines; 
extern const gui_view_t viewFactoryTest_MotorBattery; 
extern const gui_view_t viewFactoryTest_Heartrate_Measure; 
extern const gui_view_t viewFactoryTest_Heartrate_LightLeak; 

// view demo(example)
// extern const gui_view_t viewDemo;
// extern const gui_view_t viewTextScrollDemo; 
// extern const gui_view_t viewChartBarDemo;
// extern const gui_view_t viewChartColumnDemo;
// extern const gui_view_t viewChartCurveDemo; 


extern const gui_view_t viewLowPowerTip;
extern const gui_view_t viewFactoryTest;

extern const gui_view_t viewSetTime;
extern const gui_view_t viewSetDate;
extern const gui_view_t viewNotif_UnwearTip;
extern const gui_view_t viewAdvTypeSel;
extern const gui_view_t viewSetUnwearTip;
#endif 
